<template>
  <div class="child">
    <h2>child子组件部分</h2>
    <p>{{msg}}</p>
    <button @click="sendMsgToParent">向父组件传值</button>
  </div>
</template>

<script>
  export default {
    data(){
      return{
        
      }
    },
    props:["msg"],
    methods:{
      sendMsgToParent:function(){
        // 使用自定义事件传递一句话过去
        this.$emit("listenToChildEvent","this msg from child");
      }
    }
  }
</script>

<style>
</style>
